﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Data_Object;
using Models;

namespace Business_Object
{
    public class TaiKhoanService
    {
        private ITaiKhoanDao _account = DataAccess.TaiKhoanDao;
        public bool ValidateUser(string username, string password)
        {
            TaiKhoan tk = _account.ValidateUser(username, password);
            if (tk != null)
                return true;
            return false;
        }

        public void CreateUser(TaiKhoan taiKhoan)
        {
            _account.Insert(taiKhoan);
        }

        public List<TaiKhoan> All()
        {
           return _account.All();
        }

       
        public TaiKhoan Find(int id)
        {
            return _account.Find(id);

        }

        public void Insert(TaiKhoan entity)
        {
           _account.Insert(entity);
        }
      
        public void Delete(int id)
        { 
            _account.Delete(id);
        }
      

        public TaiKhoan FindByUserName(string username)
        {
            return _account.FindByUserName(username);
        }

        public void Update(TaiKhoan entity)
        {
           _account.Update(entity);
        }

    }
}
